<include file="Public/header" />
<title>我的桌面</title>
</head>
<body>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <input type="text" name="name" id="name" placeholder=" 名称" value="<{$Think.get.name}>" style="width:250px" class="input-text">
             <button id="search" class="btn btn-success" type="button"><i class="Hui-iconfont"></i> 搜索</button>
        </span>
        <span class="r">共有数据：<strong><{$count}></strong> 条</span>
    </div>
    <div class="mt-20">
        <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper no-footer">
            <table class="table table-border table-bordered table-bg table-hover table-sort dataTable no-footer" id="DataTables_Table_0" role="grid" aria-describedby="DataTables_Table_0_info">
                <thead>
                <tr class="text-c" role="row">
                    <th width="25" style="width: 25px;"><input type="checkbox" name="" value=""></th>
					<th width="80" class="" style="width: 120px;">ID</th>
					<th width="120" style="width: 220px;">变量名称</th>
                    <th tabindex="0" style="width: 487px;">英文名称</th>
                    <th width="120" style="width: 220px;">值</th>
                    <th width="120" style="width: 220px;">添加时间</th>
                    <th width="120" style="width: 220px;">操作</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="list" item="data">
                    <tr class="text-c odd" role="row">
                        <td><input type="checkbox" value="<{$data.id}>" name=""></td>
                        <td class=""><{$data.id}></td>
						 <td><{$data.name}></td>
                        <td><{$data.en_name}></td>
                        <td><{$data.value}></td>
                        <td><{$data.add_time|date="Y-m-d",###}></td>
                        <td>
                            <a style="text-decoration:none" class="ml-5" onclick="edit(this)" href="javascript:;" title="编辑"><i class="Hui-iconfont"></i></a>
                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
            <div class="page">
                <{$page}>
            </div>
        </div>
    </div>
    <script id="add_text" type="text/html">
        <div style="padding: 12px;">
            <table>
                <tr>
                    <td width="90" height="40">变量名称</td>
                    <td><input type="text" disabled class="input-text" /></td>
                </tr>
				<tr>
                    <td width="90" height="40">英文名称</td>
                    <td><input type="text" disabled class="input-text" /></td>
                </tr>
                <tr>
                    <td height="120">值</td>
                    <td><textarea style="height:100px;" type="text" class="input-text"></textarea></td>
                </tr>
            </table>
        </div>
    </script>
    <include file="Public/footer_js" />
    <script>
        $("#search").click(function (){
            if('<{$Think.get.id}>'){
                location.href="__CONTROLLER__/config/id/"+'<{$Think.get.id}>/name/'+$("#name").val();
            }else{
                location.href="__CONTROLLER__/config/id/"+'<{$id}>/name/'+$("#name").val();
            }
        });
        if("<{$id}>"!='') {
            var warehouse_id="<{$id}>";
        }else{
            var warehouse_id='<{$Think.get.id}>';
        }
        function edit(_this){
            var index=layer.open({
                type: 1,
                title:'修改',
                skin: 'layui-layer-rim', //加上边框
                area: ['600px', '310px'], //宽高
                content: $("#add_text").html(),
                btn:['确定','取消'],
                id:'post_add',
                success:function (){
                    $("#post_add input:eq(0)").prop('value',$(_this).parents('tr').find('td').eq(2).text());
                    $("#post_add input:eq(1)").prop('value',$(_this).parents('tr').find('td').eq(3).text());
                    $("#post_add textarea:eq(0)").prop('value',$(_this).parents('tr').find('td').eq(4).text());
                },
                yes:function (){
                    var name=$("#post_add input:eq(0)").val();
                    var value=$("#post_add textarea:eq(0)").val();
                    var en_name=$("#post_add input:eq(1)").val();
                    var warehouse_id=<{:I('id')}>;
                    $.post('__MODULE__/Warehouse/configEditD',{
                        name:name,
                        en_name:en_name,
                        value:value,
                        warehouse_id:warehouse_id,
                    },function (msg){
                        layer.msg(msg.data);
                        if(msg.flag==1){
                            setTimeout(function (){
                                location.reload();
                            },800);
                        }
                    },'json');
                }
            });
        }
       
    </script>
</body>
</html>